//
//  UIBarButtonIteam+Extension.swift
//  AcrossAnHui
//
//  Created by 张继强 on 16/12/13.
//  Copyright © 2016年 安徽畅通行. All rights reserved.
//

import Foundation
import UIKit
extension UIBarButtonItem{
    convenience init(title:String,imagStr:String,fontSize:CGFloat,target:AnyObject,action:Selector) {
        let button:UIButton = UIButton.init(frame: CGRect.init(x: 0, y: 0, width: 40, height: 20))
        button.setTitle(title, for: .normal)
        button.titleLabel?.font = UIFont.systemFont(ofSize: fontSize)
//        button.backgroundRect(forBounds: CGRect.init(x: 0, y: 0, width: 40, height: 40))
        button.setBackgroundImage(UIImage.init(named: imagStr), for: .normal)
        button.addTarget(target, action: action, for: .touchUpInside)
        button.sizeToFit()
        self.init(customView: button)
    }
}
